Page({

    /**
     * 页面的初始数据
     */
    data: {
        showPopup: false,
        modalTitle: '',
        subheading: '',
        todayTotal: '3',
        isShow: true,
        remainingNum: '5',
        sharePopup: false,
        currentDate: '',
        currentWeekday: ''
    },
    onBack() {
      wx.navigateBack({
          url: 1,
      });
    }, 
    showRecitePopup() {
        this.setData({
          showPopup: true,
          modalTitle: '念诵计数',
          subheading: '当日次数'
        });
    },
    showSectionPopup() {
        this.setData({
            showPopup: true,
            modalTitle: '分段计数',
            subheading: '每段次数'
        });
    },
    hideBottomPopup() {
        this.setData({
            showPopup: false,
            modalTitle: '',
            subheading: ''
        });
    },
    onButton() {
        if (this.data.modalTitle === '念诵计数') {
            this.setData({
                todayTotal: '5'
            });
            this.hideBottomPopup()
        } else {
            this.setData({
                isShow: false,
                remainingNum: '10'
            });
            this.hideBottomPopup()
        }
    },
    showSharePopup() {
        this.setData({
            sharePopup: true
        });
    },
    hideSharePopup() {
        this.setData({
            sharePopup: false
        });
    },
    getCurrentDate() {
        const date = new Date();
        const year = date.getFullYear();
        const month = date.getMonth() + 1;
        const day = date.getDate();
        const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
        const weekday = weekdays[date.getDay()];
        const currentDate = `${year}年${month}月${day}日`;
        this.setData({
          currentDate: currentDate,
          currentWeekday: weekday
        });
      },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        this.getCurrentDate()
    },
  
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {
  
    },
  
    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
  
    },
  
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {
  
    },
  
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {
  
    },
  
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {
  
    },
  
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {
  
    },
  
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {
  
    }
})